package com.lie.flat.util;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class DateUtils {
    private DateUtils() {
    }

    public static final DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");


    public static Date str2Date(String dateStr) {
        LocalDateTime ldt = LocalDateTime.parse(dateStr, df);

        ZonedDateTime zonedDateTime = ldt.atZone(ZoneId.systemDefault());

        return Date.from(zonedDateTime.toInstant());

    }
}
